package com.design.mediator.shopcenter;

// 中介者接口
interface ShoppingMallMediator {
    void rentSpace(Shop shop, int area);
    void promoteShop(Shop shop, String promotion);
}

// 商店类
class Shop {
    private String name;
    private int rentedArea;
    private ShoppingMallMediator mediator;

    public Shop(String name, ShoppingMallMediator mediator) {
        this.name = name;
        this.mediator = mediator;
    }

    public void rentSpace(int area) {
        this.rentedArea = area;
        mediator.rentSpace(this, area);
    }

    public void promote(String promotion) {
        mediator.promoteShop(this, promotion);
    }

    public String getName() {
        return name;
    }
}
